﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace StateDemo
{
    class OpeningState:ILiftState
    {
        /// <summary>
        /// 开门状态，什么都不做
        /// </summary>
        public override void Open()
        {
            Console.WriteLine("电梯门开启");
        }

        /// <summary>
        /// 关门：开门状态可以关门
        /// </summary>
        public override void Close()
        {
            //修改状态
            base.Context.LiftState = Context.ClosingState;
            //动作委托为CloseState来执行
            base.Context.LiftState.Close();
        }
        /// <summary>
        /// 门开电梯不能运行
        /// </summary>
        public override void Run()
        {
            //DoNothing
        }
        /// <summary>
        /// 要开门了，电梯肯定已经停止了
        /// </summary>
        public override void Stop()
        {
            //DoNothing
        }
    }
}
